import { Router } from 'express'
import { insert } from '../../db/dao'
import { MONEY } from '../../db/model'

const router = Router()

router.post('/add', function (req, res) {
  const money = req.body
  insert(MONEY, money).then(() => {
    res.status(200).json(money)
  }).catch(() => {
    res.status(500).end()
  })
})

export default router
